/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package PaqCliente;

/**
 *
 * @author aya
 */
public class UserGUI extends javax.swing.JPanel {
    private Usuario cli;

    /**
     * Creates new form UserGUI
     */
    public UserGUI() {
        initComponents();
        cli = new Usuario();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        p_autenticacion = new javax.swing.JLayeredPane();
        et_usuario = new javax.swing.JLabel();
        user_in = new javax.swing.JTextField();
        et_pass = new javax.swing.JLabel();
        pass_in = new javax.swing.JPasswordField();
        b_entrar = new javax.swing.JButton();

        p_autenticacion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        et_usuario.setText("Usuario: ");
        et_usuario.setBounds(20, 20, 70, 17);
        p_autenticacion.add(et_usuario, javax.swing.JLayeredPane.DEFAULT_LAYER);
        user_in.setBounds(130, 20, 150, 27);
        p_autenticacion.add(user_in, javax.swing.JLayeredPane.DEFAULT_LAYER);

        et_pass.setText("Contraseña: ");
        et_pass.setBounds(20, 60, 100, 17);
        p_autenticacion.add(et_pass, javax.swing.JLayeredPane.DEFAULT_LAYER);

        pass_in.setText("jPasswordField1");
        pass_in.setBounds(130, 60, 150, 27);
        p_autenticacion.add(pass_in, javax.swing.JLayeredPane.DEFAULT_LAYER);

        b_entrar.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        b_entrar.setText("ENTRAR");
        b_entrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                b_entrarActionPerformed(evt);
            }
        });
        b_entrar.setBounds(130, 110, 100, 34);
        p_autenticacion.add(b_entrar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(181, Short.MAX_VALUE)
                .addComponent(p_autenticacion, javax.swing.GroupLayout.PREFERRED_SIZE, 357, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(164, 164, 164))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(135, 135, 135)
                .addComponent(p_autenticacion, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(230, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void b_entrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_entrarActionPerformed
        // TODO add your handling code here:
        
        // Obtención de los datos
        String pass = new String(pass_in.getPassword());
        String user = new String(user_in.getText());
        cli.entrar("localhost",4444,this);
        this.setVisible(false);
    }//GEN-LAST:event_b_entrarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton b_entrar;
    private javax.swing.JLabel et_pass;
    private javax.swing.JLabel et_usuario;
    private javax.swing.JLayeredPane p_autenticacion;
    private javax.swing.JPasswordField pass_in;
    private javax.swing.JTextField user_in;
    // End of variables declaration//GEN-END:variables
}
